//
//  ByValueView.m
//  caipiao_ios
//
//  Created by mc on 2018/7/23.
//  Copyright © 2018年 ZhangZhanbin. All rights reserved.
//

#import "ByValueView.h"

@implementation ByValueView

- (id)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        
       
        UILabel *titleLabel = [[UILabel alloc] init];
        [self addSubview:titleLabel];
        [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self).offset(2);
            make.right.equalTo(self).offset(-2);
            make.top.equalTo(self).offset(5);
            make.height.mas_equalTo(@20);
        }];
        titleLabel.textAlignment = NSTextAlignmentCenter;
        titleLabel.font = FONT(14);
        titleLabel.textColor = [UIColor blackColor];
        titleLabel.text = @"主胜";
        self.titleLabel = titleLabel;
        
        
        UILabel *valueLabel = [[UILabel alloc] init];
        [self addSubview:valueLabel];
        [valueLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self).offset(2);
            make.right.equalTo(self).offset(-2);
            make.bottom.equalTo(self).offset(-5);
            make.height.mas_equalTo(@20);
        }];
        valueLabel.textAlignment = NSTextAlignmentCenter;
        valueLabel.font = FONT(12);
        valueLabel.textColor = [UIColor lightGrayColor];
        valueLabel.text = @"1.00";
        self.valueLabel = valueLabel;
        
        
    }
    return self;
}




- (void)setNetModel:(ByNetModel *)netModel{
    _netModel = netModel;
    if (_netModel.selected){
        self.backgroundColor = BY_THEME_COLOR;
        self.titleLabel.textColor = [UIColor whiteColor];
        self.valueLabel.textColor = [UIColor whiteColor];
        self.titleLabel.backgroundColor = BY_THEME_COLOR;
        self.valueLabel.backgroundColor = BY_THEME_COLOR;
    }else{
        self.backgroundColor = [UIColor whiteColor];
        self.titleLabel.textColor = [UIColor blackColor];
        self.valueLabel.textColor = [UIColor lightGrayColor];
        self.layer.borderColor = [UIColor lightGrayColor].CGColor;
        self.layer.borderWidth = 1;
    }
}



@end
